package com.tao.work;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.MessageProperties;
import com.utils.RabbitMQUtils;

import java.io.IOException;

/**
 * @ClassName Provider
 * @Author HETAO
 * @Date 2020/5/4 20:03
 */
public class Provider {
    public static void main(String[] args) throws IOException {
        Connection connection = RabbitMQUtils.getConnection();
        Channel channel = connection.createChannel();
        channel.queueDeclare("work", true, false, false, null);

        for (int i = 1; i <= 20; i++) {
            channel.basicPublish("", "work", MessageProperties.PERSISTENT_TEXT_PLAIN, (i + ". hello work queue").getBytes
                    ());
        }
        RabbitMQUtils.closeConnectionAndChanel(channel, connection);
    }
}
